﻿Imports System.Data.SqlClient
Public Class clsEmpleado
    Private mEmp_Id As Int32
    Private mNombre As String
    Private mApellido As String
    Private mRol_Id As Int32
    Private mRol As clsRoles
    Private mCod_Suc As Int32

    '/////////////////////////////////////////////////////////
    '/ Propiedades
    '/////////////////////////////////////////////////////////

    Public Property Emp_Id() As Int32
        Get
            Return mEmp_Id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mEmp_Id = value
            Else
                Throw New Exception("No se puede utilizar el código del empleado. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property

    Public Property Nombre() As String
        Get
            Return mNombre
        End Get
        Set(ByVal value As String)
            If value.Trim.Length > 0 And value.Trim.Length <= 40 Then
                mNombre = value.Trim.ToUpper
            Else
                Throw New Exception("No se puede utilizar el nombre del empleado.")
            End If
        End Set
    End Property
    Public Property Apellido() As String
        Get
            Return mApellido
        End Get
        Set(ByVal value As String)
            If value.Trim.Length > 0 And value.Trim.Length <= 40 Then
                mApellido = value.Trim.ToUpper
            Else
                Throw New Exception("No se puede utilizar el nombre del empleado.")
            End If
        End Set
    End Property

    Public Property Rol_Id() As Int32
        Get
            Return mRol_Id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mRol_Id = value
            Else
                Throw New Exception("No se puede utilizar el código de rol del empleado. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property
    Public Property Rol() As clsRoles
        Get
            Return mRol
        End Get
        Set(ByVal value As clsRoles)
            If value.rol_id > 0 Then
                mRol = value
            Else
                Throw New Exception("Rol Incorrecto.")
            End If
        End Set
    End Property
    Public Property Desc_Rol() As String
        Get
            Return Rol.Descri
        End Get
        Set(ByVal value As String)

        End Set
    End Property
    Public Property Cod_Suc() As Int32
        Get
            Return mCod_Suc
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mCod_Suc = value
            Else
                Throw New Exception("Codigo de sucursal incorrecto")
            End If
        End Set
    End Property

    '/////////////////////////////////////////////////////////
    '/ Métodos de la Clase
    '/////////////////////////////////////////////////////////

    '---------------------------------------------------------------------
    ' Constructor de la Clase
    '---------------------------------------------------------------------
    Public Sub New()

        MyBase.New()

    End Sub
    '---------------------------------------------------------------------
    ' Destructor de la Clase
    '---------------------------------------------------------------------
    Public Sub Dispose()

        MyBase.Finalize()

    End Sub

End Class
